﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PH.Model.Systems;
using PH.Data.Systems;
namespace PH.Logic.Systems
{
    public class BureauLogic
    {
        public static BureauModel GetModel(Guid guid)
        {
            return BureauCommand.GetModel(guid);
        }
        public static BureauModel GetModel(int id)
        {
            return BureauCommand.GetModel(id);
        }

        public static BureauCollection GetChildren(Guid guid, bool getUser = false,bool withme=false)
        {
            return BureauCommand.GetChildren(guid, getUser, withme);
        }

        public static BureauCollection GetChildrenWithMe(Guid guid)
        {
            var ret = new BureauCollection();
            var bureau = GetModel(guid);
            if (bureau != null)
            {
                ret = GetChildren(guid);
                ret.Insert(0, bureau);
                ret.TotalRecordsCount += 1;
            }
            return ret;
        }

        public static BureauCollection GetAllChildren(Guid guid, bool withme)
        {
            return  BureauCommand.GetAllChildren(guid, withme);
        }

        public static void CreateNew(BureauModel model)
        {
            BureauCommand.CreateNew(model);
        }

        public static void Update(BureauModel model)
        {
            BureauCommand.Update(model);
        }

        public static void Delete(Guid guid)
        {
            BureauCommand.Delete(guid);
        }
    }
}
